// src\component\Header.jsx
import React from 'react'
import { useInRouterContext, useNavigate } from 'react-router-dom'

export default function Header() {
    const navigate = useNavigate();
    function back() {
        navigate(-1);
    }
    function go() {
        navigate(1);
    }
    console.log("Header",useInRouterContext())

    return (
        <div>
            <div className="row">
                <div className="col-xs-offset-2 col-xs-8">
                    <div className="page-header">
                        <h2>Router Demo</h2>
                        <div>
                            <button onClick={() => back()}>返回</button>
                            <button onClick={() => go()}>前进</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    )
}
